[INTP-368] chore: Update CI repository refs, enhance client error reporting, and stabilize test DB restores#1240
Conversation
Summary of ChangesHello @pedroven, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the robustness of the client database setup process by adding a conditional flag to the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
…p command for improved behavior
…estore and fixture creation
…lify debug output
There was a problem hiding this comment.
Pull request overview
Maintenance and reliability updates spanning CI configuration, client error visibility, tutorial typing consistency, and integration test DB restore stability.
Changes:
- Update GitHub Actions workflow to checkout the webapp repo from
AnkiHubSoftware/ankihub. - Enhance
AnkiHubHTTPErrorstring output to include response content for better diagnostics. - Improve integration test DB restore logic by generating a filtered
pg_restoreTOC list that excludes schema drops; add--if-exists.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/client/test_client.py | Switch DB restore to use a filtered pg_restore TOC list and add restore flags for more robust resets with extensions. |
| ankihub/gui/tutorial.py | Align back_callback typing with next_callback to accept an on_done callback. |
| ankihub/ankihub_client/ankihub_client.py | Expand HTTP error string output to include response body for debugging. |
| .github/workflows/ci.yml | Update webapp repo checkout reference and tweak step naming. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
ankihub/gui/tutorial.py
Outdated
|
|
||
| def ensure_mw_state(state: str) -> Callable[[...], None]: | ||
| def change_state_and_call_func(func: Callable[[...], None], *args: Any, **kwargs: Any) -> None: | ||
| MainWindowStateLiteral = Literal["startup", "deckBrowser", "overview", "review", "resetRequired", "profileManager"] |
There was a problem hiding this comment.
We can use aqt.main.MainWindowState (used below)?
There was a problem hiding this comment.
Sure, I didn't notice, thank you!
Related issues
Proposed changes
This pull request introduces a set of maintenance and reliability improvements targeting both the continuous integration workflow as well as the test infrastructure and client error reporting. The following major changes are included:
CI Workflow Repository Reference Fix:
ci.yml) is updated fromankipalace/ankihubtoAnkiHubSoftware/ankihubto reflect the correct repository location.Improved Client Error Reporting:
AnkiHubHTTPErrorexception inankihub_client.pynow includes the response content, not just the status code and reason. This change provides more diagnostic context in error logs, especially for unexpected HTTP failures.Type Consistency Fix in Tutorial Code:
TutorialStep.back_callback's type is corrected for consistency withnext_callback: it now expects aCallableaccepting a callback argument, not just a parameterless lambda.Robust Database Restore in Integration Tests:
test_client.pyhas improved logic for database restoration:pg_restore --clean, a filtered table of contents (TOC) is generated that skips theSCHEMAentry. This avoids attempts to drop the schema, which can fail if extensions are present.pg_restore -l | grep -v ' SCHEMA 'and the filtered TOC (restore_toc.list) is then used with the-Loption ofpg_restore.pg_trgm,vector).--if-existsand--jobs=4help with idempotency and faster restore operations.Further comments
PR Dependency: To make the tests for this PR pass, the changes in this PR (https://github.com/AnkiHubSoftware/ankihub/pull/3340) need to be merged into the ankihub repository first. The integration tests rely on backend changes introduced there.
Test DB Restore Logic: The main motivation for the update was to address unreliable restores when using Postgres extensions, which can cause DROP SCHEMA to fail and require container-level intervention. We now surgically reset only the necessary DB objects for tests while maintaining extensions.
Richer HTTP Error Messages: These should make debugging network/client integration issues faster—the raw response often includes error messages from the API that were previously hidden from the logs.
Potential risks: - The new TOC filtering method for pg_restore assumes consistent Postgres dump behavior; future major Postgres version upgrades may alter this syntax or require TOC filtering tweaks.
In rare edge cases, errors in reading the HTTP response content could still obscure the payload (handled defensively).